//
//  YBMeetingReleaseAllReadTableViewCell.m
//  GongXinDangJian
//
//  Created by apple on 17/12/11.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "YBMeetingReleaseAllReadTableViewCell.h"

@interface YBMeetingReleaseAllReadTableViewCell ()
@property (nonatomic , strong) UILabel * cellTitleLabel;

@property (nonatomic , strong) UILabel * timeLabel;

@property (nonatomic , strong) UIImageView * attachmentImageView;

@property (nonatomic , strong) UILabel * alreadyReadNumberLabel;

@end

@implementation YBMeetingReleaseAllReadTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self ybInitMyCell];
        self.backgroundColor = [UIColor themeGrayColor];
    }
    return self;
}


-(void)ybInitMyCell{
    UIView * cellContentView = [[UIView alloc]initWithFrame:CGRectMake(0, ItemHeight * 10, [UIScreen zj_screenWith], ItemHeight * 130)];
    cellContentView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:cellContentView];
    [cellContentView addSubview:self.cellTitleLabel];
    [cellContentView addSubview:self.attachmentImageView];
    [cellContentView addSubview:self.deleteButton];
    [cellContentView addSubview:self.timeLabel];
    [cellContentView addSubview:self.alreadyReadNumberLabel];
}


-(void)setModel:(YBMeetingReleaseModel *)model
{
    _model = model;
    self.cellTitleLabel.text = [ToolClass returnNoNullStringWithString:model.TITLE];
    self.timeLabel.text = [ToolClass returnNoNullStringWithString:model.HY_START_TIME];
    if ([model.RES_COUNT integerValue] > 0) {
        self.attachmentImageView.hidden = NO;
    }
    else{
        self.attachmentImageView.hidden = YES;
    }
    self.alreadyReadNumberLabel.text = [NSString stringWithFormat:@"已报名人数:(%@/%@)" , model.ENROLL_NUM , model.NUM];
}



-(UILabel *)cellTitleLabel
{
    if (!_cellTitleLabel) {
        _cellTitleLabel = [ToolClass creatLabelWithFrame:CGRectMake(ItemWidth * 20, ItemHeight * 10, [UIScreen zj_screenWith] - ItemWidth * 198, ItemHeight * 50) font:16 textColor:[UIColor textGrayColor] text:@""];
    }
    return _cellTitleLabel;
}


-(UIImageView *)attachmentImageView
{
    if (!_attachmentImageView) {
        _attachmentImageView = [[UIImageView alloc]initWithFrame:CGRectMake([UIScreen zj_screenWith] - ItemWidth * 114, (ItemHeight * 70 - ItemWidth * 27) / 2, ItemWidth * 27, ItemWidth * 27)];
        _attachmentImageView.image = [UIImage imageNamed:@"icon_appendix"];
    }
    return _attachmentImageView;
}


-(UILabel *)timeLabel
{
    if (!_timeLabel) {
        _timeLabel = [ToolClass creatLabelWithFrame:CGRectMake(ItemWidth * 20, ItemHeight * 80, ([UIScreen zj_screenWith] - ItemWidth * 40) / 2, ItemHeight * 30) font:13 textColor:[UIColor textGrayColor] text:@""];
    }
    return _timeLabel;
}


-(UILabel *)alreadyReadNumberLabel
{
    if (!_alreadyReadNumberLabel) {
        _alreadyReadNumberLabel = [ToolClass creatLabelWithFrame:CGRectMake([UIScreen zj_screenWith] / 2, ItemHeight * 80, ([UIScreen zj_screenWith] - ItemWidth * 40) / 2, ItemHeight * 30) font:13 textColor:[UIColor textGrayColor] text:@""];
        _alreadyReadNumberLabel.textAlignment = NSTextAlignmentRight;
    }
    return _alreadyReadNumberLabel;
}




-(UIButton *)deleteButton
{
    if (!_deleteButton) {
        _deleteButton = [ToolClass createButtonWithFrame:CGRectMake([UIScreen zj_screenWith] - ItemWidth * 87, 0, ItemWidth * 87, ItemHeight * 100) text:@"" textColor:[UIColor whiteColor] imageName:@"message_back" font:15];
        _deleteButton.imageEdgeInsets = UIEdgeInsetsMake((ItemHeight * 70 - ItemWidth * 27) / 2, ItemWidth * 30, ItemHeight * 100 - (ItemHeight * 70 - ItemWidth * 27) / 2 - ItemWidth * 27, ItemWidth * 30);
    }
    return _deleteButton;
}

@end
